package edu.zju.gis.dbfg.model.tile;

import lombok.Getter;
import lombok.Setter;
import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.CmdLineParser;
import org.kohsuke.args4j.Option;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Getter
@Setter
public class TileServiceFromEsArgs {
    private final static Logger logger = LoggerFactory.getLogger(TileServiceFromEsArgs.class);

    @Option(name = "-layerName",usage = "地图服务名称", required = true)
    private String layerName = "";
    @Option(name = "-indexName",usage = "数据源Es索引", required = true)
    private String indexName = "";
    @Option(name = "-fieldsInfo",usage = "需渲染字段", required = true)
    private String fieldsAarry = "";
    @Option(name = "-keywords",usage = "关键词", required = true)
    private String keyWords = "";
    @Option(name = "-topic",usage = "主题", required = true)
    private String topic = "";
    @Option(name = "-address",usage = "服务地址", required = true)
    private String tileServerAddress = "";
    @Option(name = "-userId",usage = "用户编号", required = true)
    private String userId = "";

    public  static TileServiceFromEsArgs initArgs(String args[]){
        TileServiceFromEsArgs mArgs = new TileServiceFromEsArgs();
        CmdLineParser parser = new CmdLineParser(mArgs);
        try {
            parser.parseArgument(args);
            return mArgs;
        } catch (CmdLineException e) {
            logger.error(e.getLocalizedMessage());
            return null;
        }
    }
}
